Modernize Build System and CI/CD with uv and PEP Standards#123
Open
abstract-333 wants to merge 4 commits intoipinfo:masterfrom
Open
Modernize Build System and CI/CD with uv and PEP Standards#123abstract-333 wants to merge 4 commits intoipinfo:masterfrom
uv and PEP Standards#123abstract-333 wants to merge 4 commits intoipinfo:masterfrom
Conversation
- Replace imperative setup.py with declarative pyproject.toml (PEP 621) - Adopt PEP 517/518 compliant build system using hatchling - Pin `requires-python = ">=3.10"` to align with Build CI defaults - Remove pip-tools as uv natively handles locking and syncing - Initialize uv.lock for deterministic and faster dependency resolution - Reorganize dev dependencies into [dependency-groups]
- Update ipinfo/handler_utils.py to use __version__ instead of SDK_VERSION - Remove legacy version imports in setup.py to follow PEP 517 - Ensure User-Agent strings reflect the standardized version attribute - Align internal API with PEP 396 module versioning conventions
- Replace legacy `uv pip install` with `uv sync --all-groups` for locked dev environments - Remove manual `requirements.txt` installation in favor of pyproject.toml discovery - Clean up `uv build` by removing unnecessary `--no-build-isolation` flag - Leverage `astral-sh/setup-uv` caching for faster test and publish runs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernize packaging and CI/CD workflows by introducing a fully declarative, standards-compliant build system alongside the existing setup. By adopting
pyproject.tomlanduv, we improve reproducibility and performance in CI/CD while ensuring full backward compatibility for developers using legacy tools.Proposed Changes
🛠 Build System Migration (PEP 621)
pyproject.tomlas the primary source of truth for project metadata.setup.pyandrequirements.txtto ensure that existing automated scripts or developers preferring standardpipworkflows face zero interruptions.hatchlingas the build backend, which works seamlessly with modern PEP standards while allowing legacy tools to fall back to the existing setup.uv.lockfor 100% reproducible environments in CI, while maintainingrequirements.txtfor those not yet usinguv.🏷 Versioning & Compatibility (PEP 396)
__version__attribute in compliance with PEP 396.SDK_VERSIONas a deprecated alias to ensure any internal or external tools importing that specific constant do not break.ipinfo/handler_utils.pyto pull the version dynamically, ensuringpyproject.tomland the code remain in sync.🚀 CI/CD Optimization (GitHub Actions)
astral-sh/setup-uv. This leverages global caching and significantly faster dependency resolution.pip installtouv sync --all-groupsin CI to ensure a perfectly mirrored test environment.🛡 Stability & Compatibility Guarantee
This PR follows a "Parallel Path" strategy to ensure a frictionless transition:
uv syncanduv run pytestfor a lightning-fast, isolated experience.pip install -r requirements.txtcontinue to work exactly as they did before.🧪 Testing Performed
uv lockgenerates a valid lockfile.uv buildto generate.whland.tar.gzdistributions.uv run pytest(Pro API-dependent tests were not executed due to missing Pro API key).User-Agentheaders correctly reflect the version string from__version__.